package repository.beans;

import java.util.List;

import javax.ejb.Stateless;

import model.Candidate;
import model.Comment;
import model.Interview;
import model.User;
import repository.InterviewRepository;
import repository.exceptions.RepositoryException;

@Stateless(name = "InterviewRepository", mappedName = "ejb/InterviewRepository")
public class InterviewRepositoryBean extends
		BaseRepositoryBean<Interview, Long> implements InterviewRepository {

	public InterviewRepositoryBean() {
		super(Interview.class);
	}

	@Override
	public void addCommentToInterview(Long id, Comment c)
			throws RepositoryException {
		Interview i=this.getById(id);
		List<Comment> comms=i.getComments();
		comms.add(c);
		i.setComments(comms);
		this.merge(i);
		
	}

	@Override
	public List<Comment> getCommentsFromInterview(Long id)
			throws RepositoryException {
		Interview i=this.getById(id);
		return i.getComments();
	}

	

}
